package com.tbs.easyhomemoneyserver.config;

import com.tbs.easyhomemoneyserver.config.filters.LoginFiltter;
import com.tbs.easyhomemoneyserver.model.ApiRequest;
import com.tbs.easyhomemoneyserver.service.IApiLimitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.web.context.annotation.SessionScope;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * bean配置 ，swagger配置
 */
@Configuration
public class BeanConfig {


    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Docket docket = new Docket(DocumentationType.OAS_30)
                .apiInfo(new ApiInfoBuilder()
                        .title("家庭财务管理后端")
                        .termsOfServiceUrl("http://www.xx.com/")
                        .version("1.0")
                        .build())
                //分组名称
                .groupName("0.1")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.tbs.easyhomemoneyserver.controller")) //扫描的控制器的包名
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}
